<%@ include file="/common/taglibs.jsp"%>

<title><fmt:message key="agenda.heading"/></title>
<content tag="heading"><fmt:message key="agenda.heading"/></content>

<c:set var="buttons">
    <input type="button" class="button" onclick="location.href='<c:url value="/editAgenda.html?id=${agenda.id}"/>'"
           value="<fmt:message key="button.edit"/>"/>
    <input type="button" class="button" onclick="location.href='<c:url value="/agendas.html"/>'"
	   value="<fmt:message key="button.cancel"/>" />
    <input type="button" class="button" onclick="check_pdf();"
           value="<fmt:message key="button.pdf"/>"/>
</c:set>

<form:form commandName="agenda" method="post" action="editAgenda.html"  
    id="agendaForm" name="agendaForm">
    <form:hidden path="id"/>
    
    <li class="buttonBar bottom">
	<c:out value="${buttons}" escapeXml="false"/>
    </li>
    
    <table id="detailForm">
	<tr>
	    <td><label><fmt:message key="agenda.theme"/>:</label> </td>
	    <td><c:out value="${agenda.theme}" /> </td>
	</tr>
        <tr>
	    <td><label><fmt:message key="agenda.venue"/>:</label> </td>
	    <td><c:out value="${agenda.venue}" /> </td>
	</tr>
	<tr>
	    <td><label><fmt:message key="agenda.date"/>:</label> </td>
	    <td><fmt:formatDate value="${agenda.date}" pattern="MM/dd/yyyy"/> </td>
	</tr>
	<tr>
	    <td><label><fmt:message key="agenda.phrase"/>:</label> </td>
	    <td><c:out value="${agenda.phrase.phrase}" /> </td>
	</tr>
	<tr>
	    <td><label><fmt:message key="agenda.phrase_definition"/>:</label> </td>
	    <td><c:out value="${agenda.phrase.definition}" /> </td>
	</tr>
	<tr>
	    <td><label><fmt:message key="agenda.phrase_example"/>:</label> </td>
	    <td><c:out value="${agenda.phrase.example}" /> </td>
	</tr>
	
    <tr>
            <td> <label><fmt:message key="agenda.toastMaster"/>:</label></td>
            <td><c:out value="${agenda.toastMaster.fullName}   ${agenda.toastMaster.phoneNumber}" /></td>
    </tr>
    
    <tr>
        <td> <label><fmt:message key="agenda.general_evaluator"/>:</label></td>
            <td><c:out value="${agenda.generalEvaluator.fullName}   ${agenda.generalEvaluator.phoneNumber}" /></td>
    </tr>
    
    <tr>
        <td> <label><fmt:message key="agenda.table_topic_master"/>:</label></td>
            <td><c:out value="${agenda.tableTopicMaster.fullName}   ${agenda.tableTopicMaster.phoneNumber}" /></td>
    </tr>
    
        <tr>
        <td> <label><fmt:message key="agenda.speaker1"/>:</label></td>
            <td><c:out value="${agenda.speaker1.fullName}   ${agenda.speaker1.phoneNumber}" /></td>
    </tr>
    <tr>
        <td> <label><fmt:message key="agenda.speaker2"/>:</label></td>
            <td><c:out value="${agenda.speaker2.fullName}   ${agenda.speaker2.phoneNumber}" /></td>
    </tr>
    <tr>
        <td> <label><fmt:message key="agenda.speaker3"/>:</label></td>
            <td><c:out value="${agenda.speaker3.fullName}   ${agenda.speaker3.phoneNumber}" /></td>
    </tr>
        <tr>
        <td> <label><fmt:message key="agenda.evaluator1"/>:</label></td>
            <td><c:out value="${agenda.evaluator1.fullName}   ${agenda.evaluator1.phoneNumber}" /></td>
    </tr>
    <tr>
        <td> <label><fmt:message key="agenda.evaluator2"/>:</label></td>
            <td><c:out value="${agenda.evaluator2.fullName}   ${agenda.evaluator2.phoneNumber}" /></td>
    </tr>
    <tr>
        <td> <label><fmt:message key="agenda.evaluator3"/>:</label></td>
        <td><c:out value="${agenda.evaluator3.fullName}   ${agenda.evaluator3.phoneNumber}" /></td>
    </tr>
    <tr>
        <td> <label><fmt:message key="agenda.grammarian"/>:</label></td>
            <td><c:out value="${agenda.grammarian.fullName}   ${agenda.grammarian.phoneNumber}" /></td>
    </tr>
    <tr>
        <td> <label><fmt:message key="agenda.vote_counter"/>:</label></td>
            <td><c:out value="${agenda.voteCounter.fullName}   ${agenda.voteCounter.phoneNumber}" /></td>
    </tr>    
    <tr>
        <td> <label><fmt:message key="agenda.timer"/>:</label></td>
            <td><c:out value="${agenda.timer.fullName}   ${agenda.timer.phoneNumber}" /></td>
    </tr>
    <tr>
        <td> <label><fmt:message key="agenda.ah_counter"/>:</label></td>
            <td><c:out value="${agenda.ahCounter.fullName}   ${agenda.ahCounter.phoneNumber}" /></td>
    </tr>
    <tr>
        <td> <label><fmt:message key="agenda.secretary"/>:</label></td>
            <td><c:out value="${agenda.secretary.fullName}   ${agenda.secretary.phoneNumber}" /></td>
    </tr>    
     <tr>
        <td> <label><fmt:message key="agenda.vedio_operator"/>:</label></td>
            <td><c:out value="${agenda.videoOperator.fullName}   ${agenda.videoOperator.phoneNumber}" /></td>
    </tr>   
    <tr>
        <td> <label><fmt:message key="agenda.president"/>:</label></td>
            <td><c:out value="${agenda.president.fullName}   ${agenda.president.phoneNumber}" /></td>
    </tr>
    <tr>
        <td><label><fmt:message key="agenda.minutes"/>:</label></td>
        <td><pre><c:out value="${agenda.minutes}" /></pre></td>
    </tr>

    </table>
    <li class="buttonBar bottom">
	<c:out value="${buttons}" escapeXml="false"/>
    </li>
</form:form>

<script type="text/javascript">
    Form.focusFirstElement($('agendaForm'));

    function check_pdf() 
    {
		<c:if test="${agenda.theme == ''}">
			alert("please input the theme");
			return;
		</c:if>

		<c:if test="${agenda.venue == ''}">
			alert("please input the venue");
			return;
		</c:if>

		<c:if test="${agenda.date == ''}">
			alert("please input the date");
			return;
		</c:if>

		<c:if test="${agenda.phrase.phrase == ''}">
			alert("please input the phrase of the day");
			return;
		</c:if>

		<c:if test="${agenda.phrase.definition == ''}">
			alert("please input the phrase definition");
			return;
		</c:if>

		<c:if test="${agenda.phrase.example == ''}">
			alert("please input the phrase example");
			return;
		</c:if>

		<c:if test="${agenda.toastMaster.fullName == ''}">
			alert("please input the ToastMaster");
			return;
		</c:if>

		<c:if test="${agenda.generalEvaluator.fullName == ''}">
			alert("please input the General Evaluation");
			return;
		</c:if>

		<c:if test="${agenda.tableTopicMaster.fullName == ''}">
			alert("please input the Table Topic Master");
			return;
		</c:if>

		<c:if test="${agenda.speaker1.fullName == ''}">
			alert("please input the Speaker1");
			return;
		</c:if>

		<c:if test="${agenda.evaluator1.fullName == ''}">
			alert("please input the Evaluator for Speaker1");
			return;
		</c:if>

		<c:if test="${agenda.grammarian.fullName == ''}">
			alert("please input the Grammarian");
			return;
		</c:if>

		<c:if test="${agenda.voteCounter.fullName == ''}">
			alert("please input the Vote Counter");
			return;
		</c:if>

		<c:if test="${agenda.timer.fullName == ''}">
			alert("please input the Timer");
			return;
		</c:if>

		<c:if test="${agenda.ahCounter.fullName == ''}">
			alert("please input the Ah Counter");
			return;
		</c:if>

		<c:if test="${agenda.president.fullName == ''}">
			alert("please input the President");
			return;
		</c:if>
		
		location.href='<c:url value="/agendaDetail.html?id=${agenda.id}&presentationtype=pdf"/>'
    }
</script>

<v:javascript formName="agenda" cdata="false" dynamicJavascript="true" staticJavascript="false"/>

